#!/bin/bash

# 1. 清除所有celery线程
echo "Stopping all celery processes..."
ps aux | grep "celery" | grep -v grep | awk '{print $2}' | xargs -r kill -9

# 2. 结束运行在6006端口上的进程
echo "Stopping processes on port 6006..."
PID=$(lsof -t -i :6006)
if [[ ! -z $PID ]]; then
    echo "Killing process on port 6006 with PID: $PID"
    kill -9 $PID
fi

echo "All Celery and FastAPI processes have been stopped."

